export default {
    atleastonenumber (v) {
        const s = '0123456789'
        v = v || "";
        for (let i = 0; i < v.length; i++) {
            if (s.indexOf(v[i]) !== -1) {
                return true;
            }
        }
        return '请至少包含一个数字'
    },
    atleastoneletter(v) {
        v = v || "";
        for (let i = 0; i < v.length; i++) {
            if (('a' <= v[i] && 'z' >= v[i]) || ('A' <= v[i] && 'Z' >= v[i])) {
                return true;
            }
        }
        return `至少包含一个英文字母`;
    },
    nocn(v) {
        return ((v || '').indexOf(' ') === -1) || `请尽量不使用汉字`;
    },
    nospace(v) {
        return ((v || '').indexOf(' ') === -1) || `不允许出现空格`;
    },
    lengthcontrol(v,min=6,max=20) {
        return ((v || '').length >= min && (v || '').length <= max) || `字段长度请控制在${min}-${max}之间`;
    }
}